#!/bin/bash
clear
echo ""
echo -e "\033[31m Steamcommunity302 For Steam Deck 安装 \033[0m"
dir_=$(pwd)
cd $dir_
echo "当前目录:" $dir_
current_user=$(whoami)
has_root() {
    if [[ $current_user != "root" ]]; then
        echo "权限需要提升:输入root密码以继续执行脚本" 1>&2
        echo "若未设置过root密码请先打开终端输入passwd进行设置" 1>&2
		echo "" 1>&2
		read -p "请输入root密码:" userpasswd
		chmod +x $dir_/install.sh
		echo $userpasswd | sudo -S $dir_/install.sh
		exit 1
    fi
}
has_root

echo "清理旧文件"
rm -f steamcommunity_302.caddy
rm -f s302.run.sh
rm -f steamcommunity_302.service
rm -f /etc/systemd/system/steamcommunity_302.service
rm -f /etc/systemd/system/multi-user.target.wants/steamcommunity_302.service
echo "下载后端程序"
#wget -N -O steamcommunity_302.caddy --no-check-certificate https://caddyserver.com/api/download?os=linux&arch=amd64
#wget -N -O steamcommunity_302.caddy --no-check-certificate https://www.dogfight360.com/Usbeam/caddy_linux_amd64
download_status=$(curl -k -o $dir_/steamcommunity_302.caddy -w "%{http_code}" https://www.dogfight360.com/Usbeam/caddy_linux_amd64)
    if [[ $download_status != 200 ]]; then
	    echo -e "\033[31m 后端程序下载失败,请检查网络并重新执行安装脚本! \033[0m"
	    echo -e "\033[31m 后端程序下载失败,请检查网络并重新执行安装脚本! \033[0m"
	    echo -e "\033[31m 后端程序下载失败,请检查网络并重新执行安装脚本! \033[0m"
		exit 1
    fi
echo "赋予后端程序执行属性"
chmod +x $dir_/steamcommunity_302.caddy
chown deck:deck $dir_/"steamcommunity_302.caddy"
echo "创建服务文件"
cat > steamcommunity_302.service <<EOF
[Unit]
Description=steamcommunity_302
[Service]
ExecStart=$dir_/s302.run.sh
[Install]
WantedBy=multi-user.target
EOF
echo "创建运行脚本"
cat > s302.run.sh <<EOF
#!/bin/sh
cd $dir_
sudo -S $dir_/steamcommunity_302.caddy run --config $dir_/steamcommunity_302.caddy.json --adapter caddyfile
EOF
chown deck:deck $dir_/"s302.run.sh"
chmod +x s302.run.sh
echo "安装服务"
chown deck:deck $dir_/"steamcommunity_302.service"
cp $dir_/steamcommunity_302.service /etc/systemd/system/steamcommunity_302.service -f
chmod +x /etc/systemd/system/steamcommunity_302.service
ln -s $dir_/steamcommunity_302.service /etc/systemd/system/multi-user.target.wants/
echo "备份并写入hosts文件,hosts备份保存于/etc/hosts.backup.*"
mv /etc/hosts /etc/hosts.backup.$(date +%s) -f

echo "安装证书"
#echo "安装nss(certutil)"
#pacman -Sy nss --noconfirm
echo "复制证书"
cp $dir_/steamcommunityCA.pem /etc/ca-certificates/trust-source/anchors/steamcommunityCA.crt -f
echo "导入证书"
if [ -d "/home/deck/.pki/nssdb" ]; then
certutil -D -d sql:/home/deck/.pki/nssdb -n "Steamcommunity302" > /dev/null 2>&1
certutil -A -d sql:/home/deck/.pki/nssdb -n "Steamcommunity302" -t C,, -i "$dir_/steamcommunityCA.pem"
fi
if [ -d "/home/deck/.var/app/com.valvesoftware.Steam/.pki/nssdb" ]; then
certutil -D -d sql:/home/deck/.var/app/com.valvesoftware.Steam/.pki/nssdb -n "Steamcommunity302" > /dev/null 2>&1
certutil -A -d sql:/home/deck/.var/app/com.valvesoftware.Steam/.pki/nssdb -n "Steamcommunity302" -t C,, -i "$dir_/steamcommunityCA.pem"
fi
sudo -S trust extract-compat

echo "创建卸载脚本"
cat > $dir_/"uninstall.sh" <<'EOF'
#!/bin/bash
clear
echo ""
echo -e "\033[31m Steamcommunity302 For Steam Deck 卸载 \033[0m"
dir_=$(pwd)
cd $dir_
echo "当前目录:" $dir_
current_user=$(whoami)
has_root() {
    if [[ $current_user != "root" ]]; then
        echo "权限需要提升:输入root密码以继续执行脚本" 1>&2
		echo "" 1>&2
		read -p "请输入root密码:" userpasswd
		echo $userpasswd |sudo -S $dir_/uninstall.sh
		exit 1
    fi
}
has_root
echo "停止服务"
systemctl stop steamcommunity_302.service
echo "删除服务"
rm $dir_/steamcommunity_302.service -f
rm /etc/systemd/system/steamcommunity_302.service -f
rm /etc/systemd/system/multi-user.target.wants/steamcommunity_302.service -f
echo "删除证书"
if [ -d "/home/deck/.pki/nssdb" ]; then
certutil -D -d sql:/home/deck/.pki/nssdb -n "Steamcommunity302"
fi
if [ -d "/home/deck/.var/app/com.valvesoftware.Steam/.pki/nssdb" ]; then
certutil -D -d sql:/home/deck/.var/app/com.valvesoftware.Steam/.pki/nssdb -n "Steamcommunity302"
fi
rm /etc/ca-certificates/trust-source/anchors/steamcommunityCA.crt -f
sudo -S trust extract-compat
echo "备份hosts"
mv /etc/hosts /etc/hosts.backup.$(date +%s) -f
echo "清空hosts"
echo "" > /etc/hosts
echo "刷新系统服务"
systemctl daemon-reload
echo -e "\033[31m 卸载完成,请手动删除目录下残留文件 \033[0m"
EOF

chown deck:deck $dir_/"uninstall.sh"
chmod +x $dir_/"uninstall.sh"
echo "写入hosts"
cat > /etc/hosts <<EOF
127.0.0.1 steamcommunity.com #S302
127.0.0.1 www.steamcommunity.com #S302
127.0.0.1 store.steampowered.com #S302
127.0.0.1 checkout.steampowered.com #S302
127.0.0.1 api.steampowered.com #S302
127.0.0.1 help.steampowered.com #S302
127.0.0.1 login.steampowered.com #S302
127.0.0.1 store.akamai.steamstatic.com #S302
127.0.0.1 discord.com #S302
127.0.0.1 updates.discord.com #S302
127.0.0.1 discordapp.com #S302
127.0.0.1 dl.discordapp.net #S302
127.0.0.1 dl2.discordapp.net #S302
127.0.0.1 stable.dl2.discordapp.net #S302
127.0.0.1 ptb.dl2.discordapp.net #S302
127.0.0.1 blog.discord.com #S302
127.0.0.1 medium.com #S302
127.0.0.1 gateway.discord.gg #S302
127.0.0.1 discord.gg #S302
127.0.0.1 gateway-cf.discord.gg #S302
127.0.0.1 gateway-us-east1-d.discord.gg #S302
127.0.0.1 remote-auth-gateway.discord.gg #S302
127.0.0.1 gateway-us-east1-b.discord.gg #S302
127.0.0.1 gateway-us-east1-c.discord.gg #S302
127.0.0.1 media.discordapp.net #S302
127.0.0.1 images-ext-2.discordapp.net #S302
127.0.0.1 images-ext-1.discordapp.net #S302
127.0.0.1 url9177.discordapp.com #S302
127.0.0.1 canary-api.discordapp.com #S302
127.0.0.1 cdn-ptb.discordapp.com #S302
127.0.0.1 ptb.discordapp.com #S302
127.0.0.1 status.discordapp.com #S302
127.0.0.1 cdn-canary.discordapp.com #S302
127.0.0.1 cdn.discordapp.com #S302
127.0.0.1 streamkit.discordapp.com #S302
127.0.0.1 i18n.discordapp.com #S302
127.0.0.1 url9624.discordapp.com #S302
127.0.0.1 url7195.discordapp.com #S302
127.0.0.1 merch.discordapp.com #S302
127.0.0.1 printer.discordapp.com #S302
127.0.0.1 canary.discordapp.com #S302
127.0.0.1 apps.discordapp.com #S302
127.0.0.1 pax.discordapp.com #S302
127.0.0.1 status.discord.com #S302
127.0.0.1 streamkit.discord.com #S302
127.0.0.1 feedback.discord.com #S302
127.0.0.1 click.discord.com #S302
127.0.0.1 pax.discord.com #S302
127.0.0.1 printer.discord.com #S302
127.0.0.1 ptb.discord.com #S302
127.0.0.1 canary.discord.com #S302
127.0.0.1 canary.discord.com #S302
127.0.0.1 bugs.discord.com #S302
127.0.0.1 i18n.discord.com #S302
127.0.0.1 support.discord.com #S302
127.0.0.1 safety.discord.com #S302
127.0.0.1 support-dev.discord.com #S302
127.0.0.1 discord-attachments-uploads-prd.storage.googleapis.com #S302
127.0.0.1 twitch.tv #S302
127.0.0.1 www.twitch.tv #S302
127.0.0.1 m.twitch.tv #S302
127.0.0.1 app.twitch.tv #S302
127.0.0.1 music.twitch.tv #S302
127.0.0.1 blog.twitch.tv #S302
127.0.0.1 inspector.twitch.tv #S302
127.0.0.1 dev.twitch.tv #S302
127.0.0.1 clips.twitch.tv #S302
127.0.0.1 spade.twitch.tv #S302
127.0.0.1 gql.twitch.tv #S302
127.0.0.1 vod-secure.twitch.tv #S302
127.0.0.1 vod-storyboards.twitch.tv #S302
127.0.0.1 trowel.twitch.tv #S302
127.0.0.1 extension-files.twitch.tv #S302
127.0.0.1 vod-metro.twitch.tv #S302
127.0.0.1 player.m7g.twitch.tv #S302
127.0.0.1 help.twitch.tv #S302
127.0.0.1 passport.twitch.tv #S302
127.0.0.1 id.twitch.tv #S302
127.0.0.1 id-cdn.twitch.tv #S302
127.0.0.1 player.twitch.tv #S302
127.0.0.1 api.twitch.tv #S302
127.0.0.1 cvp.twitch.tv #S302
127.0.0.1 pubsub-edge.twitch.tv #S302
127.0.0.1 ingest.twitch.tv #S302
127.0.0.1 assets.help.twitch.tv #S302
127.0.0.1 assets.twitch.tv #S302
127.0.0.1 discuss.dev.twitch.tv #S302
127.0.0.1 irc-ws.chat.twitch.tv #S302
127.0.0.1 irc-ws-r.chat.twitch.tv #S302
127.0.0.1 dashboard.twitch.tv #S302
127.0.0.1 appeals.twitch.tv #S302
127.0.0.1 safety.twitch.tv #S302
127.0.0.1 brand.twitch.tv #S302
127.0.0.1 usher.ttvnw.net #S302
127.0.0.1 steambroadcast.akamaized.net #S302
127.0.0.1 steamvideo-a.akamaihd.net #S302
127.0.0.1 steamstore-a.akamaihd.net #S302
127.0.0.1 steamusercontent-a.akamaihd.net #S302
127.0.0.1 steamcommunity-a.akamaihd.net #S302
127.0.0.1 steamcdn-a.akamaihd.net #S302
127.0.0.1 steamuserimages-a.akamaihd.net #S302
127.0.0.1 community.akamai.steamstatic.com #S302
127.0.0.1 avatars.akamai.steamstatic.com #S302
127.0.0.1 community.steamstatic.com #S302
127.0.0.1 cdn.akamai.steamstatic.com #S302
127.0.0.1 avatars.steamstatic.com #S302
127.0.0.1 shared.akamai.steamstatic.com #S302
127.0.0.1 clan.akamai.steamstatic.com #S302
127.0.0.1 cdn.cloudflare.steamstatic.com #S302
127.0.0.1 community.cloudflare.steamstatic.com #S302
127.0.0.1 store.cloudflare.steamstatic.com #S302
127.0.0.1 avatars.cloudflare.steamstatic.com #S302
127.0.0.1 clan.cloudflare.steamstatic.com #S302
127.0.0.1 shared.cloudflare.steamstatic.com #S302
127.0.0.1 www.google.com #S302
127.0.0.1 steam-chat.com #S302
127.0.0.1 hb.imgix.net #S302
127.0.0.1 fanatical.imgix.net #S302
127.0.0.1 mod.io #S302
127.0.0.1 static.mod.io #S302
127.0.0.1 api.mod.io #S302
127.0.0.1 docs.mod.io #S302
127.0.0.1 beta.mod.io #S302
127.0.0.1 blog.mod.io #S302
127.0.0.1 binary.lge.modcdn.io #S302
127.0.0.1 auth.mod.io #S302
127.0.0.1 github.com #S302
127.0.0.1 www.github.com #S302
127.0.0.1 gist.github.com #S302
127.0.0.1 api.github.com #S302
127.0.0.1 raw.github.com #S302
127.0.0.1 raw.githubusercontent.com #S302
127.0.0.1 camo.githubusercontent.com #S302
127.0.0.1 cloud.githubusercontent.com #S302
127.0.0.1 avatars.githubusercontent.com #S302
127.0.0.1 avatars0.githubusercontent.com #S302
127.0.0.1 avatars1.githubusercontent.com #S302
127.0.0.1 avatars2.githubusercontent.com #S302
127.0.0.1 avatars3.githubusercontent.com #S302
127.0.0.1 private-user-images.githubusercontent.com #S302
127.0.0.1 user-images.githubusercontent.com #S302
127.0.0.1 github-releases.githubusercontent.com #S302
127.0.0.1 analytics.githubassets.com #S302
127.0.0.1 github-releases.githubusercontent.com #S302
127.0.0.1 objects.githubusercontent.com #S302
127.0.0.1 assets-cdn.github.com #S302
127.0.0.1 github.githubassets.com #S302
127.0.0.1 support-assets.githubassets.com #S302
127.0.0.1 codeload.github.com #S302
127.0.0.1 pages.github.com #S302
127.0.0.1 docs.github.com #S302
127.0.0.1 services.github.com #S302
127.0.0.1 resources.github.com #S302
127.0.0.1 developer.github.com #S302
127.0.0.1 partner.github.com #S302
127.0.0.1 desktop.github.com #S302
127.0.0.1 support.github.com #S302
127.0.0.1 education.github.com #S302
127.0.0.1 enterprise.github.com #S302
127.0.0.1 lab.github.com #S302
127.0.0.1 classroom.github.com #S302
127.0.0.1 central.github.com #S302
127.0.0.1 desktop.githubusercontent.com #S302
127.0.0.1 guides.github.com #S302
127.0.0.1 copilot.github.com #S302
127.0.0.1 github.io #S302
127.0.0.1 www.github.io #S302
127.0.0.1 *.github.io #[Please change the prefix to support github.io] #S302
127.0.0.1 api1.origin.com #S302
127.0.0.1 onedrive.live.com #S302
127.0.0.1 skyapi.onedrive.live.com #S302
127.0.0.1 static.wikia.nocookie.net #S302
127.0.0.1 img.wikia.nocookie.net #S302
127.0.0.1 img1.wikia.nocookie.net #S302
127.0.0.1 img2.wikia.nocookie.net #S302
127.0.0.1 img3.wikia.nocookie.net #S302
127.0.0.1 img4.wikia.nocookie.net #S302
127.0.0.1 img5.wikia.nocookie.net #S302
127.0.0.1 images.wikia.nocookie.net #S302
127.0.0.1 images1.wikia.nocookie.net #S302
127.0.0.1 images2.wikia.nocookie.net #S302
127.0.0.1 images3.wikia.nocookie.net #S302
127.0.0.1 images4.wikia.nocookie.net #S302
127.0.0.1 images5.wikia.nocookie.net #S302
127.0.0.1 vignette.wikia.nocookie.net #S302
127.0.0.1 vignette1.wikia.nocookie.net #S302
127.0.0.1 vignette2.wikia.nocookie.net #S302
127.0.0.1 vignette3.wikia.nocookie.net #S302
127.0.0.1 vignette4.wikia.nocookie.net #S302
127.0.0.1 vignette5.wikia.nocookie.net #S302
127.0.0.1 blockbench.net #S302
127.0.0.1 www.blockbench.net #S302
127.0.0.1 web.blockbench.net #S302
127.0.0.1 steamcloud-ugc.storage.googleapis.com #S302
127.0.0.1 cdn.jsdelivr.net #S302
127.0.0.1 ap-southeast-2-prod-prodpc01-reg-httpping.p76prod.systems #S302
127.0.0.1 us-east-1-prod-prodpc01-reg-httpping.p76prod.systems #S302
127.0.0.1 eu-central-1-prod-prodpc01-reg-httpping.p76prod.systems #S302
127.0.0.1 eu-west-1-prod-prodpc01-reg-httpping.p76prod.systems #S302
127.0.0.1 www.youtube.com #S302
127.0.0.1 xgpuweb.gssv-play-prod.xboxlive.com #S302
127.0.0.1 xsts.auth.xboxlive.com #S302
127.0.0.1 xgpuwebf2p.gssv-play-prod.xboxlive.com #S302
127.0.0.1 xhome.gssv-play-prod.xboxlive.com #S302
127.0.0.1 eau.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 seau.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 brs.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 eus.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 eus2.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 ejp.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 ckr.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 ncus.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 scus.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 uks.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 weu.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 wus.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 wus2.core.gssv-play-prod.xboxlive.com #S302
127.0.0.1 artstation.com #S302
127.0.0.1 www.artstation.com #S302
127.0.0.1 ws.artstation.com #S302
127.0.0.1 cdn.artstation.com #S302
127.0.0.1 cdn1.artstation.com #S302
127.0.0.1 cdn2.artstation.com #S302
127.0.0.1 cdna.artstation.com #S302
127.0.0.1 cdna0.artstation.com #S302
127.0.0.1 cdna2.artstation.com #S302
127.0.0.1 cdn-animation.artstation.com #S302
127.0.0.1 cdnb.artstation.com #S302
127.0.0.1 cdnb1.artstation.com #S302
127.0.0.1 cdnb3.artstation.com #S302
127.0.0.1 cdnc.artstation.com #S302
127.0.0.1 cdn-learning.artstation.com #S302
127.0.0.1 pinterest.com #S302
127.0.0.1 www.pinterest.com #S302
127.0.0.1 accounts.pinterest.com #S302
127.0.0.1 accounts-oauth.pinterest.com #S302
127.0.0.1 creator.pinterest.com #S302
127.0.0.1 creators.pinterest.com #S302
127.0.0.1 career.pinterest.com #S302
127.0.0.1 curate.pinterest.com #S302
127.0.0.1 partners.pinterest.com #S302
127.0.0.1 try.pinterest.com #S302
127.0.0.1 asset.pinterest.com #S302
127.0.0.1 cookies.pinterest.com #S302
127.0.0.1 teens.pinterest.com #S302
127.0.0.1 teen.pinterest.com #S302
127.0.0.1 r.pinterest.com #S302
127.0.0.1 ro.pinterest.com #S302
127.0.0.1 eval.pinterest.com #S302
127.0.0.1 pinfluencers.pinterest.com #S302
127.0.0.1 mqtt.pinterest.com #S302
127.0.0.1 prod-about.pinterest.com #S302
127.0.0.1 codeofconduct.pinterest.com #S302
127.0.0.1 create.pinterest.com #S302
127.0.0.1 anket.pinterest.com #S302
127.0.0.1 trk.pinterest.com #S302
127.0.0.1 trk-v4.pinterest.com #S302
127.0.0.1 trk2.pinterest.com #S302
127.0.0.1 publishers.pinterest.com #S302
127.0.0.1 adminapp.pinterest.com #S302
127.0.0.1 community.pinterest.com #S302
127.0.0.1 curators.pinterest.com #S302
127.0.0.1 commerce.pinterest.com #S302
127.0.0.1 developer.pinterest.com #S302
127.0.0.1 toronto.pinterest.com #S302
127.0.0.1 mdp.pinterest.com #S302
127.0.0.1 investor.pinterest.com #S302
127.0.0.1 prod-brand.pinterest.com #S302
127.0.0.1 status.pinterest.com #S302
127.0.0.1 app.pinterest.com #S302
127.0.0.1 positivity.pinterest.com #S302
127.0.0.1 brand.pinterest.com #S302
127.0.0.1 canary.pinterest.com #S302
127.0.0.1 assets.pinterest.com #S302
127.0.0.1 help.pinterest.com #S302
127.0.0.1 business.pinterest.com #S302
127.0.0.1 developers.pinterest.com #S302
127.0.0.1 policy.pinterest.com #S302
127.0.0.1 blog.pinterest.com #S302
127.0.0.1 newsroom.pinterest.com #S302
127.0.0.1 about.pinterest.com #S302
127.0.0.1 engineering.pinterest.com #S302
127.0.0.1 careers.pinterest.com #S302
127.0.0.1 api.pinterest.com #S302
127.0.0.1 ads.pinterest.com #S302
127.0.0.1 ads-mock.pinterest.com #S302
127.0.0.1 analytics.pinterest.com #S302
127.0.0.1 passets-cdn.pinterest.com #S302
127.0.0.1 trends.pinterest.com #S302
127.0.0.1 support.pinterest.com #S302
127.0.0.1 media-cache-ec0.pinterest.com #S302
127.0.0.1 twotwenty.pinterest.com #S302
127.0.0.1 log.pinterest.com #S302
127.0.0.1 media-cache-ec1.pinterest.com #S302
127.0.0.1 post.pinterest.com #S302
127.0.0.1 labs.pinterest.com #S302
127.0.0.1 passets-ec.pinterest.com #S302
127.0.0.1 wellbeing.pinterest.com #S302
127.0.0.1 widgets.pinterest.com #S302
127.0.0.1 thepoint.pinterest.com #S302
127.0.0.1 catalogs.pinterest.com #S302
127.0.0.1 passets-ak.pinterest.com #S302
127.0.0.1 passets.pinterest.com #S302
127.0.0.1 latest.pinterest.com #S302
127.0.0.1 partners-api.pinterest.com #S302
127.0.0.1 dev.pinterest.com #S302
127.0.0.1 pinterest.jp #S302
127.0.0.1 www.pinterest.jp #S302
127.0.0.1 pinterest.kr #S302
127.0.0.1 www.pinterest.kr #S302
127.0.0.1 pinterest.info #S302
127.0.0.1 www.pinterest.info #S302
127.0.0.1 pinimg.com #S302
127.0.0.1 s.pinimg.com #S302
127.0.0.1 i.pinimg.com #S302
127.0.0.1 i2.pinimg.com #S302
127.0.0.1 sm.pinimg.com #S302
127.0.0.1 v.pinimg.com #S302
127.0.0.1 v1.pinimg.com #S302
127.0.0.1 v2.pinimg.com #S302
127.0.0.1 v3.pinimg.com #S302
127.0.0.1 h2.pinimg.com #S302
127.0.0.1 u.pinimg.com #S302
127.0.0.1 u2.pinimg.com #S302
127.0.0.1 s-media-cache-ak0.pinimg.com #S302
127.0.0.1 media-cache-ak0.pinimg.com #S302
127.0.0.1 media-cache-ec0.pinimg.com #S302
127.0.0.1 media-cache-cd0.pinimg.com #S302
127.0.0.1 media-cache-ak1.pinimg.com #S302
127.0.0.1 media-cache-ak2.pinimg.com #S302
127.0.0.1 s-media-cache-ec0.pinimg.com #S302
127.0.0.1 s-passets-ec.pinimg.com #S302
127.0.0.1 media-cache-ec2.pinimg.com #S302
127.0.0.1 media-cache-ec3.pinimg.com #S302
127.0.0.1 media-cache-ec4.pinimg.com #S302
127.0.0.1 i-h2.pinimg.com #S302
127.0.0.1 media-cache-ak3.pinimg.com #S302
127.0.0.1 i-h1.pinimg.com #S302
127.0.0.1 s-passets-cache-ak0.pinimg.com #S302
127.0.0.1 s-passets.pinimg.com #S302
127.0.0.1 media-cache-ec1.pinimg.com #S302
127.0.0.1 imgur.com #S302
127.0.0.1 www.imgur.com #S302
127.0.0.1 api.imgur.com #S302
127.0.0.1 i.imgur.com #S302
127.0.0.1 s.imgur.com #S302
127.0.0.1 t.imgur.com #S302
127.0.0.1 rt.imgur.com #S302
127.0.0.1 i.stack.imgur.com #S302
127.0.0.1 p.imgur.com #S302
127.0.0.1 m.imgur.com #S302
127.0.0.1 blog.imgur.com #S302
127.0.0.1 steamcloud-eu-ams.storage.googleapis.com #S302
127.0.0.1 steamcloud-eu-fra.storage.googleapis.com #S302
127.0.0.1 steamcloud-finland.storage.googleapis.com #S302
127.0.0.1 steamcloud-saopaulo.storage.googleapis.com #S302
127.0.0.1 steamcloud-singapore.storage.googleapis.com #S302
127.0.0.1 steamcloud-sydney.storage.googleapis.com #S302
127.0.0.1 steamcloud-taiwan.storage.googleapis.com #S302
127.0.0.1 steamcloud-eu.storage.googleapis.com #S302
127.0.0.1 ajax.googleapis.com #S302
127.0.0.1 launcher.mojang.com #S302
127.0.0.1 launchermeta.mojang.com #S302
127.0.0.1 sessionserver.mojang.com #S302
127.0.0.1 api.minecraftservices.com #S302
127.0.0.1 textures.minecraft.net #S302
127.0.0.1 redstone-launcher.mojang.com #S302
127.0.0.1 api.mojang.com #S302
127.0.0.1 account.mojang.com #S302
127.0.0.1 minecraft.net #S302
127.0.0.1 www.minecraft.net #S302
127.0.0.1 help.minecraft.net #S302
127.0.0.1 launchercontent.mojang.com #S302
127.0.0.1 piston-meta.mojang.com #S302
127.0.0.1 assets.mojang.com #S302
127.0.0.1 session.minecraft.net #S302
127.0.0.1 libraries.minecraft.net #S302
127.0.0.1 resources.download.minecraft.net #S302
127.0.0.1 pocket.realms.minecraft.net #S302
127.0.0.1 payments.realms.minecraft.net #S302
127.0.0.1 pc.realms.minecraft.net #S302
127.0.0.1 realms.minecraft.net #S302
127.0.0.1 piston-data.mojang.com #S302
127.0.0.1 mega.io #S302
127.0.0.1 www.mega.io #S302
127.0.0.1 blog.mega.io #S302
127.0.0.1 help.mega.io #S302
127.0.0.1 transparency.mega.io #S302
127.0.0.1 mega.nz #S302
127.0.0.1 help.mega.nz #S302
127.0.0.1 g.api.mega.co.nz #S302
127.0.0.1 eu.api.mega.co.nz #S302
127.0.0.1 vercel.app #S302
127.0.0.1 vercel.com #S302
127.0.0.1 *.vercel.app #[Please change the prefix to support vercel.app] #S302
127.0.0.1 huggingface.co #S302
127.0.0.1 www.huggingface.co #S302
127.0.0.1 datasets-server.huggingface.co #S302
127.0.0.1 cdn-thumbnails.huggingface.co #S302
127.0.0.1 transformer.huggingface.co #S302
127.0.0.1 transformers.huggingface.co #S302
127.0.0.1 cdn-avatars.huggingface.co #S302
127.0.0.1 cdn-lfs-us-1.huggingface.co #S302
127.0.0.1 cdn-uploads.huggingface.co #S302
127.0.0.1 cdn-lfs-eu-1.huggingface.co #S302
127.0.0.1 convai.huggingface.co #S302
127.0.0.1 cdn-lfs.huggingface.co #S302
127.0.0.1 cdn.huggingface.co #S302
127.0.0.1 cdn-datasets.huggingface.co #S302
127.0.0.1 discuss.huggingface.co #S302
127.0.0.1 status.huggingface.co #S302
127.0.0.1 ui.endpoints.huggingface.co #S302
127.0.0.1 store.huggingface.co #S302
127.0.0.1 dell.huggingface.co #S302
127.0.0.1 neuralconvo.huggingface.co #S302
127.0.0.1 home.huggingface.co #S302
127.0.0.1 api-inference.huggingface.co #S302
127.0.0.1 thumbnails.huggingface.co #S302
127.0.0.1 ui.autotrain.huggingface.co #S302
127.0.0.1 support.parsec.app #S302
127.0.0.1 parsec.app #S302
127.0.0.1 pages.parsec.app #S302
127.0.0.1 dash.parsec.app #S302
127.0.0.1 go.parsec.app #S302
127.0.0.1 url2415.parsec.app #S302
127.0.0.1 status.parsec.app #S302
127.0.0.1 zendesk1.parsec.app #S302
127.0.0.1 account.parsec.app #S302
127.0.0.1 zendesk2.parsec.app #S302
127.0.0.1 kessel-api.parsec.app #S302
127.0.0.1 builds.parsec.app #S302
127.0.0.1 www.parsec.app #S302
127.0.0.1 teams.parsec.app #S302
127.0.0.1 public.parsec.app #S302
127.0.0.1 web.parsec.app #S302
127.0.0.1 careers.parsec.app #S302
127.0.0.1 articles.parsec.app #S302
127.0.0.1 deps.parsec.app #S302
127.0.0.1 zendesk4.parsec.app #S302
127.0.0.1 tracking.parsec.app #S302
127.0.0.1 resources.parsec.app #S302
127.0.0.1 zendesk3.parsec.app #S302
127.0.0.1 kessel-ws.parsec.app #S302
127.0.0.1 email.parsec.app #S302
127.0.0.1 blog.parsec.app #S302
127.0.0.1 api.parsec.app #S302
127.0.0.1 xp.parsec.app #S302
127.0.0.1 parsecusercontent.com #S302
127.0.0.1  store.st.dl.eccdnx.com #S302
127.0.0.1  media.st.dl.eccdnx.com #S302
127.0.0.1  avatars.st.dl.eccdnx.com #S302
127.0.0.1  clan.st.dl.eccdnx.com #S302
127.0.0.1  video.st.dl.eccdnx.com #S302
127.0.0.1  shared.st.dl.eccdnx.com #S302

EOF

echo "创建日志查看脚本"
cat > $dir_/"log.sh" <<EOF
journalctl -u steamcommunity_302.service -f -n 100
EOF

chown deck:deck $dir_/"log.sh"
chmod +x $dir_/"log.sh"
echo "启动服务"
systemctl daemon-reload
systemctl stop steamcommunity_302.service
systemctl start steamcommunity_302.service

echo -e "\033[31m -------程序以当前目录程序运行,请勿删除当前目录!-------- \033[0m"
echo -e "\033[31m ------------------------------------------------------- \033[0m"
echo -e "\033[31m -----------安装完成已完成,可直接关闭该窗口!------------ \033[0m"
